#include "snakesnake.h"

SnakeSnake::SnakeSnake(QObject *parent) :
    QObject(parent)
{
    size = 0;
    points = 0;
}

void SnakeSnake::createSnake(Point head, quint32 length)
{
    snake.clear();
    for(quint32 i = 0; i < length; i++)
        snake.push_back(head);
}

void SnakeSnake::killSnake()
{
    snake.clear();
}

const QList<Point> &SnakeSnake::getBody()
{
    return snake;
}

Point SnakeSnake::getHead()
{
    return snake.first();
}


void SnakeSnake::move(Point newHeadPosition)
{
    snake.pop_back();
    snake.push_front(newHeadPosition);
}

void SnakeSnake::increase()
{
    snake.push_back(snake.last());
}

void SnakeSnake::decrease()
{
    snake.pop_back();
}

qint32 SnakeSnake::getPoints()
{
    return points;
}

void SnakeSnake::addPoints(qint32 additive)
{
    points+=additive;
}
